<?php
/**
 * 秒杀视图
 * @author tangbl
 * 
 */
class SeckillViewModel extends ViewModel {
	
	public $viewFields = array(
			
     'Product'=>array(
     		'_type'=>'LEFT',
     		'isdel',
     		'lang',
     		'solevar',
     		'unit',
     		'package',
     		'weight',
     		'buynum',
     		'recnum',
     		'title',
     		'description',
     		'type',
			'jifen',
     	),
			
     'Seckill'=>array(
     		'id',
     		'pid',
     		'mprice',
     		'sprice',
     		'expire',
     		'begintime',
     		'endtime',
     		'refund',
     		'buynum',
     		'pernum',
     		'total',
     		'prompt',
     		'summary',
     		'sort',
     		'addtime',
     		'addid',
     		'solevar'=>'slvar',
     		'_on'=>'Product.id=Seckill.pid'
     	)
   );
	
	
	/**
	 * 获取确认订单的商品列表
	 */
	public function getConfirmList($select){
	
		$id   = $select[0];
		$num  = $select[1];
		
		$map   = array("pid"=>$id);
		$list  = $this->where($map)->find(); 
		$total = intval($num) * doubleval($list['sprice']);
		$weight= intval($num) * intval($list['weight']);
		
		$list['num']    = $num;
		$array['amount']= $num;
		$array['weight']= $weight;
		$array['total'] = $total;
		$array['list']  = array($list);
	
		return $array;
	}
	
}
?>